
export default{
    taborder_arr:[],
    initHtml(ScreenData={},param,callback){
        var title = `<div class="widget-header widget-header-small widget-header-blue widget-header-flat">
                        <h5 class="widget-title">
                            <i class="`+param.icon+`" aria-hidden="true"></i>
                            `+param['title']+`

                        </h5>
                        <div class="widget-toolbar">
                            <a href="#" data-action="collapse">
                                <i class="ace-icon fa fa-chevron-up"></i>
                            </a>
                        </div>
                        <div class="widget-toolbar">

                        </div>
                    </div>`
        console.log(JSON.stringify(param))
        var html =  `<div class="widget-box custom_form" style="margin:0 0 5px 0;">
                        <style>
                            .ui-jqgrid-btable .ui-widget-content.ui-state-highlight{
                                background-color: #c9ebef;
                            }
                        </style>
                        `+((param['title']&&param['title']!="")?title:'')+`
                        <div class="widget-body">
                            <form class="widget-main"  id="`+param.cpname+`" style="min-height:35px;`+param.style+`">
                            
                            </form>
                        </div>
                    </div>`

        $(param.menuBoxId).append(html)

        callback();
    },

    initFormContent(data=[],param,callback){
        let _this = this;
        $.each(data,function(key,value){
            if(value.display!="1" && value.display!="none"){

                var html = '';

                var readonly =""
				if(value.readonly=="1"||value.readonly=="readonly"){
					readonly = "readonly='readonly'"
				}

                switch (value.type) {
                    case 'text':
                        html =  `<div id="`+value.name+`_box" style="display:flex">
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <input  autocomplete="off" class="custom_form_go `+value['class']+`" id="`+value.name+`" name="`+value.name+`" data-taborder="`+value.taborder+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;"  spellcheck="false">
                                    </div>
                                </div>`;

                            //添加到html
                            _this.sortDiv(value,param,html)

                            if(value.value!=""){
                                $("#"+param.cpname+" #"+value.name).val(value.value)
                            }

                            if(value['onclick']!=""){
                                $("#"+param.cpname+" #"+value.name).unbind("click").click(function(){
                                    var html = _this.reconvert(value['onclick'])
                                    eval(html);
                                })
                            }
                        break;
                    case 'select':
                        var option_html = ''
                        var options = value.options==""?'[]':value.options
                        $.each(JSON.parse(options),function(kk,vv){
                            option_html+='<option value="'+vv.code+'">'+vv.descript+'</option>'
                        })
                        html =  `<div id="`+value.name+`_box" style="display:flex" >
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <select id="`+value.name+`" class="custom_form_go `+value['class']+`" name="`+value.name+`" data-taborder="`+value.taborder+`" style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;">`+option_html+`</select>
                                    </div>
                                </div>`;

                            //添加到html
                            _this.sortDiv(value,param,html)

                            if(value.value!=""){
                                $("#"+param.cpname+" #"+value.name).val(value.value)
                            }
                        break;
                    case 'textarea':
                        html =  `<div id="`+value.name+`_box" style="display:flex" >
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <textarea class="custom_form_go `+value['class']+`" id="`+value.name+`"  name="`+value.name+`" data-taborder="`+value.taborder+`" style="height:75px;max-width:100%;`+value.style+`;"></textarea>
                                    </div>
                                </div>`;

                            //添加到html
                            _this.sortDiv(value,param,html)

                            if(value.value!=""){
                                $("#"+param.cpname+" #"+value.name).val(value.value)
                            }
                        break; 
                    case 'radio':
                        var checked=""
                        if(value.checked=="checked"){
                            checked='checked="checked"'
                        }
                        debugger
                        html =	`<label class="control-label" id="rb_`+value.value_save+`" style="margin-right:5px;float:left;margin-top: 0px;margin-bottom: 0px;">
                                    <input name="`+value.name+`" value="`+value.value_save+`" type="radio" class="ace custom_form_go" data-taborder="`+value.taborder+`" `+checked+` `+readonly+`>
                                    <span class="lbl" style="vertical-align: middle;">`+value.value+`</span>
                                </label>`;

                        if( $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").size()<=0){
                            $("#"+param.cpname+"").append('<div class="" style="min-height: 0px;display:flow-root" data-line="'+value.row+'"></div>')
                        }

                        if(value['col'] && value['col']!='' ){
                            if($("#"+param.cpname+"").find("div[data-line='"+value.row+"']").find("div[data-col='"+value.col+"']").size()<=0){
                                $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").append('<div class="'+value['tclass']+' no-padding" data-col="'+value.col+'" style="display:flex"></div>')
                            }
            
                            if($("#"+param.cpname+"").find("div[data-radio='"+value.name+"']").size()<=0){
                                var html1 = `<div id="`+value.name+`_box" style="display:flex" >
                                                <div class="" style="text-align:right" >
                                                    <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                                </div>
                                                <div data-radio="`+value.name+`" class=" no-padding" style="min-height: 0px;flex:1;overflow: hidden;">
                                                </div>
                                            </div>`;
    
                                $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").find("div[data-col='"+value.col+"']").append(html1)
                            }

                            // $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").find("div[data-col='"+value.col+"']").append(html)
                        }else{
                            if($("#"+param.cpname+"").find("div[data-radio='"+value.name+"']").size()<=0){
                                var html1 = '<div class="'+value['tclass']+' no-padding" data-col="'+value.col+'" style="display:flex">';
                                if($("#"+param.cpname+"").find("div[data-radio='"+value.name+"']").size()<=0){
                                    html1 +=    `<div id="`+value.name+`_box" style="display:flex" >
                                                    <div class="" style="text-align:right" >
                                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                                    </div>
                                                    <div data-radio="`+value.name+`" class=" no-padding" style="min-height: 0px;flex:1;overflow: hidden;">
                                                    </div>
                                                </div>`;
        
                                    // $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").find("div[data-col='"+value.col+"']").append(html1)
                                }
                                html1 += '</div>';
                            }
                            $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").append(html1)
                        }
                        
                        
                        
                        $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").find("div[data-radio='"+value.name+"']").append(html)
                        
                        if(value['onclick']!=""){
                            $("#"+param.cpname+" [name="+value.name+"][value="+value.value_save+"]").parent("label").find("span.lbl").unbind("click").click(function(){

                                var html = _this.reconvert(value['onclick'])
                                eval(html);
                            })
                        }

                        break;

                    case 'checkbox':
                        var checked=""
                        if(value.checked=="checked"){
                            checked='checked="checked"'
                        }

                        html =  `<div id="`+value.name+`_box" style="display:flex">
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <label class="control-label" style="margin-right:5px;float:left;margin-top: 0px;margin-bottom: 0px;">
                                            <input name="`+value.name+`" value="`+value.value_save+`" type="checkbox" class="ace" `+checked+` `+readonly+`>
                                            <span class="lbl" style="vertical-align: middle;">`+value.value+`</span>
                                        </label>
                                    </div>
                                </div>`;

                         //添加到html
                         _this.sortDiv(value,param,html)


                        break;
                    case 'button':
                        if(value.header == "header"){
                            html =  `<a href="javascript:void(0)" name="`+value.name+`" class="btn btn-primary btn-minier btn-round `+value['tclass']+`" style="padding:0 2px;" data-i18n="`+value['class']+`">
                                        <i class="ace-icon  `+value['class']+`"></i>
                                        `+value.text+`
                                    </a>`

                            _this.sortDiv(value,param,html)

                            if(value['onclick']!=""){
                                $("#"+param.cpname).parents(".custom_form").find("a[name='"+value.name+"']").unbind("click").click(function(){
                                    var html = _this.reconvert(value['onclick'])
                                    eval(html);
                                })
                            }
                        }
                        
                        break;
                    case 'quickModal':
                    case 'quickModalMulti':
                        html =  `<div id="`+value.name+`_box" style="display:flex" >
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <input  autocomplete="off" class="custom_form_go `+value['class']+`" id="`+value.name+`" name="`+value.name+`" data-taborder="`+value.taborder+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;" spellcheck="false" >
                                    </div>
                                </div>`;

                            //添加到html
                            _this.sortDiv(value,param,html)

                            _this.initQckModal(value,param)

                            $("#"+value.name+"_qckModal,#"+value.name).unbind("click").click(function(e){
                                e.stopPropagation();
                                $(".qckModal").addClass("hide");
                                $("#"+value.name+"_qckModal").removeClass("hide");

                                
                                if($(this).attr("id")==value.name){ //点击input时
                                    var ds =  $("#"+param.cpname+"").find("[name='"+value.name+"']").val()
                                    var grid_selector = $("#"+value.name+"_qckModal").find("#"+value.name+"_qckGrid")
                                    grid_selector.trigger("reloadGrid");
                                    $.each(ds.split(","),function(key,value){
                                        grid_selector.jqGrid('setSelection',value,false);
                                    })
                                }
                                
                            });

                            $(document).click(function(){
                                if(!$("#"+value.name+"_qckModal").hasClass("hide")){
                                    $("#"+value.name+"_qckModal").addClass("hide")
                                }
                            });

                            if(value.value!=""){
                                $("#"+param.cpname+" #"+value.name).val(value.value)
                            }
                        break;
                    case 'multiselect':
						var option_html = ''
                        $.each(JSON.parse(value.options),function(kk,vv){
                            option_html+='<option value="'+vv.code+'">'+vv.descript+'</option>'
                        })
						html = 	`<div id="`+value.name+`_box" style="display:flex" >
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <select id="`+value.name+`" name="`+value.name+`" class="custom_form_go multiselect `+value['class']+`" multiple="" data-taborder="`+value.taborder+`" style="height:29.5px; `+value.style+`">`+option_html+`</select>
                                    </div>
                                </div>`
                        //添加到html
                        _this.sortDiv(value,param,html)

                        if(value.value!=""){
                            $("#"+param.cpname+" #"+value.name).val(value.value)
                        }

						break;
                    case 'modal_profile':
						html =  `<div id="`+value.name+`_box" style="display:flex">
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <span class="input-icon input-icon-right">
                                            <input  autocomplete="off" class=" `+value['class']+` hide" id="`+value.name+`" name="`+value.name+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;" spellcheck="false" >
                                            <input  autocomplete="off" class="custom_form_go `+value['class']+`" id="`+value.name+`_c" name="`+value.name+`_c" data-taborder="`+value.taborder+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;" spellcheck="false" >
                                            <i id="help_`+value.name+`" data-id="" class="ace-icon fa fa-caret-down bigger-150" style="cursor: pointer;"></i>
                                        </span>
                                    </div>
                                </div>`;

                        _this.sortDiv(value,param,html)

                        if(value.value!=""){
                            $("#"+param.cpname+" #"+value.name).val(value.value)
                        }
                        
                        $("#help_"+value.name).unbind("click").click(function(){
                            if(!$.isFunction($().selection_fromProfile)){
                                $.ajaxSetup({ async: false, cache: false });
                                $.getScript("components/custom/jquery.selection_fromProfile.js");
                                $.ajaxSetup({ async: true });
                            }

                            $(this).modalFrame("destroy");
                            $(this).modalFrame("init",function(modalEle){
                                $("#"+modalEle).modal("show");
                                $("#"+modalEle).selection_fromProfile({
                                    gname : $("#"+param.cpname+" #"+value.name+"_c").val().trim(), 
                                    dataBack:function(data){
                                        $("#"+param.cpname+" #"+value.name).val(data.pno)
                                        $("#"+param.cpname+" #"+value.name+"_c").val(data.gname)
                                    },
                                    searchBack:function(searchValue){

                                    }
                                })
                            })
                        })
                        break;
                    case 'modal_company':
                        html =  `<div  id="`+value.name+`_box" style="display:flex" >
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <span class="input-icon input-icon-right">
                                            <input  autocomplete="off" class=" `+value['class']+` hide" id="`+value.name+`" name="`+value.name+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;" spellcheck="false" >
                                            <input  autocomplete="off" class="custom_form_go `+value['class']+`" id="`+value.name+`_c" name="`+value.name+`_c" data-taborder="`+value.taborder+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;" spellcheck="false" >
                                            <i id="help_`+value.name+`" data-id="" class="ace-icon fa fa-caret-down bigger-150" style="cursor: pointer;"></i>
                                        </span>
                                    </div>
                                </div>`;

                        _this.sortDiv(value,param,html)

                        if(value.value!=""){
                            $("#"+param.cpname+" #"+value.name).val(value.value)
                        }
                        
                        $("#help_"+value.name).unbind("click").click(function(){
                            if(!$.isFunction($().selection_fromProfileCompany)){
                                $.ajaxSetup({ async: false, cache: false });
                                $.getScript("components/custom/jquery.selection_fromProfileCompany.js");
                                $.ajaxSetup({ async: true });
                            }

                            $(this).modalFrame("destroy");
                            $(this).modalFrame("init",function(modalEle){
                                $("#"+modalEle).modal("show");
                                $("#"+modalEle).selection_fromProfileCompany({
                                    dataBack:function(data){
                                        $("#"+param.cpname+" #"+value.name).val(data.pno)
                                        $("#"+param.cpname+" #"+value.name+"_c").val(data.gname)
                                    },
                                    searchBack:function(searchValue){

                                    }
                                })
                            })
                        })
                        break;
                    case 'modal_member':
                        html =  `<div id="`+value.name+`_box" style="display:flex" >
                                    <div class="" style="text-align:right" >
                                        <label class="" style="margin-top: 0px;margin-bottom: 0px;min-width: 60px;vertical-align: middle;`+value.tstyle+`;">`+value.text+`&nbsp;&nbsp;</label>
                                    </div>
                                    <div class="" style="flex:1;overflow: hidden;">
                                        <span class="input-icon input-icon-right">
                                            <input  autocomplete="off" class=" `+value['class']+` hide" id="`+value.name+`" name="`+value.name+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;" spellcheck="false" >
                                            <input  autocomplete="off" class="custom_form_go `+value['class']+`" id="`+value.name+`_c" name="`+value.name+`_c" data-taborder="`+value.taborder+`" `+readonly+` style="height:29px;vertical-align: middle;max-width:100%;`+value.style+`;" spellcheck="false" >
                                            <i id="help_`+value.name+`" data-id="" class="ace-icon fa fa-caret-down bigger-150" style="cursor: pointer;"></i>
                                        </span>
                                    </div>
                                </div>`;

                        _this.sortDiv(value,param,html)

                        if(value.value!=""){
                            $("#"+param.cpname+" #"+value.name).val(value.value)
                        }
                        
                        $("#help_"+value.name).unbind("click").click(function(){
                            if(!$.isFunction($().selection_membershipCard)){
                                $.ajaxSetup({ async: false, cache: false });
                                $.getScript("components/custom/jquery.selection_membershipCard.js");
                                $.ajaxSetup({ async: true });
                            }

                            $(this).modalFrame("destroy");
                            $(this).modalFrame("init",function(modalEle){
                                $("#"+modalEle).modal("show");
                                $("#"+modalEle).selection_membershipCard({
                                    oper : "s",
                                    dataBack:function(data){
                                        $("#"+param.cpname+" #"+value.name).val(data.mno)
                                        $("#"+param.cpname+" #"+value.name+"_c").val(data.mname)
                                    },
                                    searchBack:function(searchValue){

                                    }
                                })
                            })
                        })
                        break;
                    default:
                        break;
                }

                
            }
        })

        $('.custom_form [data-col]').not('[data-col=""]').each(function(){
            var number = $(this).children("div").length;
            var width = ((1/number)*100).toFixed(2)+"%"
            $(this).children("div").css("max-width",width)
        })

        var tab_arr = []
        $(".custom_form_go").each(function(){
            if($(this).attr("data-taborder")!=""){
                tab_arr.push({"name":$(this).attr("name"),"taborder":$(this).attr("data-taborder")})
            }
        })
        _this.taborder_arr = tab_arr.sort(_this.compare('taborder'))

        //绑定enter事件
        $(".custom_form_go").unbind("keydown").keydown(function(e){
            if(e.keyCode=="13"){
                var value = {name:$(this).attr("name")}
                _this.goNext(value)
            }
        });

        $('.custom_form .date-picker').datepicker({
            autoclose : true,
            language : 'zh-CN',
            format : 'yyyymmdd',
            todayHighlight: true,
            todayBtn:'linked',
            clearBtn: true,
        });
        
        $('.custom_form .time-picker').timepicker({
            minuteStep : 1,
			showSeconds : false,
			showMeridian : false,
			defaultTime:false,
			use24hours: true,
	        // format: 'HH:mm',
            template:false,
        })

        $('.spinbox-input').ace_spinner({min:0,step:1, btn_up_class:'btn-info',btn_down_class:'btn-info'}).closest('.ace-spinner')
            .on('changed.fu.spinbox', function(){
            });

        $.mask.definitions['~']='[+-]';
        $('.custom_form .time-picker').mask('99:99');
    },

    
    //显示DIV
    sortDiv(value,param,html){
        if(value.header == "header"){
            $("#"+param.cpname+"").parents(".custom_form").find(".widget-toolbar").eq(1).append(html)
        }else{
            if( $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").size()<=0){
                $("#"+param.cpname+"").append('<div class="" style="min-height: 0px;display:flow-root" data-line="'+value.row+'"></div>')
            }

            if(value['col'] && value['col']!='' ){
                if($("#"+param.cpname+"").find("div[data-line='"+value.row+"']").find("div[data-col='"+value.col+"']").size()<=0){
                    $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").append('<div class="'+value['tclass']+' no-padding" data-col="'+value.col+'" style="display:flex"></div>')
                }

                $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").find("div[data-col='"+value.col+"']").append(html)
            }else{
                html = '<div class="'+value['tclass']+' no-padding" data-col="'+value.col+'" style="display:flex">'+
                            html+
                        '</div>';
                $("#"+param.cpname+"").find("div[data-line='"+value.row+"']").append(html)
            }
            
        }
        
    },


    //显示快捷模态选择
    initQckModal(value,param){
        var $this = this;
        var _this = $("#"+value.name)
        // console.log(JSON.stringify(value))
        var top = $(_this).offset().top;
        var bottom = $(window).height() - top - $(_this).height()
        var left = $(_this).offset().left;
        var right = $(window).width() - left - $(_this).width()

        var modal_top = top
        if(bottom<500){
            modal_top = $(window).height() - 500
        }

        var modal_left = left+$(_this).width()+8
        if(right<360){
            modal_left = left - 360 -8
        }

        var bottomBtn = `<div class="form-actions" style="margin:0;padding:5px 15px;text-align: right;">
                            <button type="button" class="btn btn-sm btn-info btn-white `+value.name+`_qckModalCheck">
                                <i class="ace-icon fa fa-check icon-on-right bigger-110"></i>
                                确认
                            </button>
                        </div>`
        var html = `<div id="`+value.name+`_qckModal" class="qckModal hide" style="position:fixed;border:2px solid #CCCCCC;width:360px;height:500px;left:`+modal_left+`px;top:`+modal_top+`px;z-index:1050;background:#FFF">
                        <div class="widget-box" style="margin:0">
                            <div id="`+value.name+`_qckGridBox" class="widget-body " style="margin:0">
                                <table id="`+value.name+`_qckGrid"></table>
                                <div id="`+value.name+`_qckGridPager"></div>
                                `
                                +((value['type']=="quickModalMulti")?bottomBtn:'')+
                                `
                            </div>
                        </div>
                    </div>`

        if($("body").find("#"+value.name+"_qckModal").size()>0){
            $("#"+value.name+"_qckModal").remove()
        }
        $("body").append(html)
        var grid_selector = $("#"+value.name+"_qckModal").find("#"+value.name+"_qckGrid");
        var pager_selector = $("#"+value.name+"_qckModal").find("#"+value.name+"_qckGridPager");
        grid_selector.jqGrid("GridUnload");
        //构造表格
        grid_selector.jqGrid({
            width :354,
            height : ((value['type']=="quickModalMulti")?413:452),
            data: JSON.parse(value.options),
            datatype : 'local',  
            colNames : ["代码","名称","",""],
            colModel : [{
                name : "code",//"代码",
                index : "code",
                width : 140,
                key:true,
            },{
                name : "descript",//"名称",
                index : "descript",
                width: 140,
            },{
                name : "code1",//"代码",
                index : "code1",
                width: 140,
            },{
                name : "code2",//"代码",
                index : "code2",
                width: 140,
            }],    	
            sortname : "code",
            sortorder : "asc",
            viewrecords : true,
            rowNum : 10000,
            emptyrecords: "没有搜索到任何数据",
            recordtext: "共计:{2}条",
            altRows : true,  
            scrollrows:true,
            shrinkToFit : true,
            multiselect : (value['type']=="quickModalMulti"),
            scroll: true,
            onSelectRow:function(rowid){
                // rowdata = grid_selector.jqGrid("getRowData",rowid);
                if(!(value['type']=="quickModalMulti")){
                    var returnValue = $(grid_selector).jqGrid('getGridParam', 'selrow');
                    $("#"+param.cpname+"").find("[name='"+value.name+"']").val(returnValue)
                    setTimeout(() => {
                        $("#"+value.name+"_qckModal").addClass("hide")
                        $this.goNext(value)
                    }, 100);
                }
            },
            ondblClickRow: function(rowid) { 
            },
            loadComplete : function(data) {
                var table = this;
                
            }, 
        });

        
        //***多选***时候的确认按钮
        $("."+value.name+"_qckModalCheck").unbind("click").click(function(e){
            e.stopPropagation();
            var returnValue = $(grid_selector).jqGrid('getGridParam', 'selarrrow').join(",");
            if(returnValue.length>0 && returnValue.substr(0, 1)==","){
                returnValue=returnValue.substring(1);
            }
            $("#"+param.cpname+"").find("[name='"+value.name+"']").val(returnValue)

            $("#"+value.name+"_qckModal").addClass("hide")
            $this.goNext(value)
        })
    },

    //跳转到下一个表单输入框
    goNext(value){
        let _this = this
        var ishave = 'no'
        $.each(_this.taborder_arr,function(kk,vv){
            debugger
            if($.trim(vv.name) == $.trim(value.name)){
                ishave = 'yes'
                if(kk+1 == _this.taborder_arr.length){
                    $(".custom_form_go[name='"+_this.taborder_arr[0]['name']+"']").focus().trigger("click")
                }else{
                    $(".custom_form_go[name='"+_this.taborder_arr[kk+1]['name']+"']").focus().trigger("click")
                }
                
            }
        })
        if(ishave == 'no'){
            $(".custom_form_go[name='"+_this.taborder_arr[0]['name']+"']").focus().trigger("click")
        }
        

        // if($(".custom_form [name='"+value.name+"']").hasClass("custom_form_go")){
        //     var index = $(".custom_form_go").index($(".custom_form [name='"+value.name+"']"));
        //     for(var i = index ;i<=$(".custom_form_go").length;i++){
        //         if($(".custom_form_go").eq(i+1).attr("name")!=value.name){
        //             $(".custom_form_go").eq(i+1).focus().trigger("click")
        //             break
        //         }
        //     }
            
        // }
    },

    //unicode转utf-8
    reconvert:function(str){ 
            str = str.replace(/(\\u)(\w{1,4})/gi,function($0){ 
                return (String.fromCharCode(parseInt((escape($0).replace(/(%5Cu)(\w{1,4})/g,"$2")),16))); 
            }); 
            str = str.replace(/(&#x)(\w{1,4});/gi,function($0){ 
                return String.fromCharCode(parseInt(escape($0).replace(/(%26%23x)(\w{1,4})(%3B)/g,"$2"),16)); 
            }); 
            str = str.replace(/(&#)(\d{1,6});/gi,function($0){ 
                return String.fromCharCode(parseInt(escape($0).replace(/(%26%23)(\d{1,6})(%3B)/g,"$2"))); 
            }); 
             
            return str; 
    },

    compare:function(property){
        return function(a,b){
            var value1 = a[property];
            var value2 = b[property];
            return value1 - value2;
        }
    },

}